<%@ page language="java" import="java.util.*,java.io.*" pageEncoding="utf-8"%>
<%@ page contentType="application/msexcel" %>
<%@page import="dao.*"  %>
<%@page import="entity.*"  %>>
<%@page import="java.util.List"  %>

<%
   response.setHeader("Content-disposition","attachment; filename=test.xls");
   
   //以上这行设定传送到前端浏览器时的档名为test.xls
   //就是靠这一行，让前端浏览器以为接收到一个excel档 
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">   
  </head>
  
  <body>
<br>
<table border="1" width="100%">
<tr> <td>id</td> <td>pld</td> <td>name</td> <td>sex</td> <td>birthdate</td>
    </tr>
<%
	List<JavaBean> users2=StudentDao.readList();
for(JavaBean l:users2)
{
%>
		  <tr>
       <td><%=l.getId() %></td>
          <td><%=l.getpId() %></td>
          <td><%=l.getName() %></td>
           <td><%=l.getSex() %></td>
           <td><%=l.getBirthdate() %></td>
      </tr>
<% }
 %>
 

 
</table>
  </body>
</html>
